package com.itheima.自习.第一次.第十九题;

//
//定义Person类
public class Person{
    //        属性：（姓名，年龄）
    private String name;
    private int age;
//        生成空参有参构造，set和get方法
    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
//        行为：keepPet( ????? ,String something)方法
//        ​ 功能：喂养【宠物狗】和【宠物猫】，问号处自己思考，something表示喂养的东西
    public void keepPet(Animal animal ,String something){
        System.out.println("年龄为"+this.getAge()+ "岁的" + this.getName()+ "养了一只"+ animal.getColor()+ "颜色的"+ animal.getAge()+"岁的宠物");
        animal.eat(something);
    }
}
